"""
归一化：
    将每行的数值转为百分比（0-1）
"""
import numpy as np
import sklearn.preprocessing as sp

raw_sample = np.array([[10.0,20.0,5.0],
                       [8.0,10.0,1.0]])

nor_sample = raw_sample.copy()

for row in nor_sample:
    row /= abs(row).sum()
print(nor_sample)


res = sp.normalize(raw_sample,norm='l1')
print("Sklearn")
print(res)
